home *** CD-ROM | disk | FTP | other *** search
/ Hráč 2004 August / Hrac_72_2004-08_dvd.iso / dema / Rapid Gun / rg_setup.exe / common / image_BlackAndWhite.fx < prev    next >
Text File  |  2004-04-21  |  3KB  |  99 lines

  1. // LF2 Engine
  2. // (C) 2002-3 7FX
  3. //---------------------------------------------------------------------------
  4. // Desc
  5. string desc : Description = "Image shader, ktery meni zobrazeni na cerno-bile.";
  6. // Shader type phase
  7. string type : Type = "image";
  8. //---------------------------------------------------------------------------
  9. // Constant for luminance calculation
  10. const float4 cLum = {0.3f, 0.59f, 0.11f, 1.f};
  11. //---------------------------------------------------------------------------
  12. // Render target texture
  13. texture RT : RenderTargetFSMap;
  14. //---------------------------------------------------------------------------
  15. sampler sRT = sampler_state
  16. {
  17.     Texture = <RT>;
  18.     MinFilter = POINT;
  19.     MagFilter = POINT;
  20.     AddressU = CLAMP;
  21.     AddressV = CLAMP;
  22. };
  23. //---------------------------------------------------------------------------
  24. // Pixel shader
  25. float4 PS20(float2 uv: TEXCOORD0) : COLOR
  26. {
  27.     return dot(tex2D(sRT, uv).rgb, cLum.rgb);
  28. }
  29. //---------------------------------------------------------------------------
  30. // Pixel shader
  31. float4 PS14(float2 uv: TEXCOORD0) : COLOR
  32. {
  33.     float4 currFrameSample = tex2D(sRT, uv);
  34.     return (currFrameSample.x*cLum.x + currFrameSample.y*cLum.y + currFrameSample.z*cLum.z);
  35. }
  36. //---------------------------------------------------------------------------
  37. technique vs0_ps20
  38. {
  39.     pass p0
  40.     {
  41.            ZEnable = false;
  42.         ZWriteEnable = false;
  43.  
  44.         PixelShader  = compile ps_2_0 PS20();
  45.     }
  46. }
  47. //---------------------------------------------------------------------------
  48. technique vs0_ps14
  49. {
  50.     pass p0
  51.     {
  52.            ZEnable = false;
  53.         ZWriteEnable = false;
  54.    
  55.         PixelShader  = compile ps_1_4 PS14();
  56.     }
  57. }
  58. //---------------------------------------------------------------------------
  59. technique vs0_ps11
  60. {
  61.     pass p0
  62.     {
  63.            ZEnable = false;
  64.         ZWriteEnable = false;
  65.    
  66.    
  67.         Sampler[0] = <sRT>;
  68.         
  69.         PixelShaderConstantF[0] = <cLum>;
  70.         PixelShader  = asm
  71.         {
  72.             ps.1.1
  73.             
  74.             tex t0
  75.             
  76.             dp3 r0, t0, c0
  77.         };
  78.     }
  79. }
  80. //---------------------------------------------------------------------------
  81. // Inaccurate - DotProduct3 uses (-0.5) in all componets, so black is white and white is black
  82. technique vs0_ps0
  83. {
  84.     pass p0
  85.     {
  86.            ZEnable = false;
  87.         ZWriteEnable = false;
  88.    
  89.         TextureFactor = <cLum>;
  90.         
  91.         Sampler[0] = <sRT>;
  92.         ColorOp[0] = DotProduct3;
  93.         ColorArg1[0] = Texture;
  94.         COlorArg2[0] = TFactor;
  95.         AlphaOp[0] = SelectArg1;
  96.         AlphaArg1[0] = Texture;
  97.     }
  98. }
  99. //---------------------------------------------------------------------------